<?php
  namespace Home\Controller;
   use Think\Controller;
   class   DownController extends Controller {
		public function index(){
		   
               if(IS_POST)
     {        
            
                $m=M('goods');
                $data['id']=$_POST['id'];
                //$this->success('数据修改成功','index');
                $data['url']=$_POST['url'];
                $data['name']=$_POST['name'];
                $count=$m->save($data);
                if($count>0){
                  $this->ajaxReturn("修改数据成功 !",'eval');
                  }else{
                  $this->ajaxReturn("修改失败！",'eval');
             }
      } elseif(IS_GET){
        $m=M('goods');
        $id['id']=$_GET['id'];
        $data=$m->where($id)->find(); 
        $this->assign('dat',$data);//留言总数
        $this->display();
     }
      else{
      
        $this->error('非法操作哦！');
      }
   }         
     //$this->display();  
		public function tiqu(){
		   
               if(IS_POST)
     {  
             
                $id['id']=$_POST['id'];
                $pass=$_POST['pass'];
                $m=M('goods');
               $result=$m->where($id)->find();
                if( $result['pass']==$pass )
                {
          
                 $data['status'] = 1;
                 $data['content'] =$result['down'] ;
                $this->ajaxReturn($data);
                 
               //  $this->assign('dat',$result);//留言总数 
               //  $this->redirect(down/index);  
               //  $this->display();
                  
                
                }else{
                     $data['msg'] ="提取码错误！";
                     $data['status'] =2;
                     $this->ajaxReturn($data);
                    //$this->ajaxReturn("提取码错误！",'eval');
                }
     
     
       }else{
     
       $this->error('非法操作哦！');
     }
	}
	
}
?>